﻿using Learun.Util;
using SqlSugar;
using System;
using System.Collections.Generic;
namespace Learun.Application.TwoDevelopment.ZZDT_EC

{
    /// <summary>
    /// 版 本 PIT-ADMS V7.0.3 敏捷开发框架
    /// Copyright (c) 2013-2018 Hexagon PPM
    /// 创 建：超级管理员
    /// 日 期：2022-01-30 15:57
    /// 描 述：图纸文件
    /// </summary>
    [SugarTable(TableName = "ec_drawing_file")]
    public class ec_drawing_fileEntity
    {
        #region 实体成员
        /// <summary>
        /// 图纸文件ID
        /// </summary>
        /// <returns></returns>
        [SugarColumn(IsPrimaryKey = true)]
        public string DrawingFileID { get; set; }
        /// <summary>
        /// 图纸目录ID
        /// </summary>
        /// <returns></returns>
        public string DrawingCatalogueID { get; set; } = "";
        /// <summary>
        /// 图纸文件名称
        /// </summary>
        /// <returns></returns>
        public string DrawingFileName { get; set; } = "";

        /// <summary>
        /// 图纸类型
        /// </summary>
        /// <returns></returns>
        public string DrawingType { get; set; } = "";
        /// <summary>
        /// 图纸阶段
        /// </summary>
        /// <returns></returns>
        public string DrawingStage { get; set; } = "";
        /// <summary>
        /// 所属系统
        /// </summary>
        /// <returns></returns>
        public string DrawingSystem { get; set; } = "";
        /// <summary>
        /// 图纸描述1
        /// </summary>
        /// <returns></returns>
        public string Describe1 { get; set; } = "";
        /// <summary>
        /// 图纸描述2
        /// </summary>
        /// <returns></returns>
        public string Describe2 { get; set; } = "";
        /// <summary>
        /// 图纸描述3
        /// </summary>
        /// <returns></returns>
        public string Describe3 { get; set; } = "";
        /// <summary>
        /// 版本
        /// </summary>
        /// <returns></returns>
        public string FileVersion { get; set; } = "";
        /// <summary>
        /// 是否发布
        /// </summary>
        /// <returns></returns>
        [NullValue]
        public int? IsPublish { get; set; }
        /// <summary>
        /// 是否检出
        /// </summary>
        /// <returns></returns>
        [NullValue]
        public int? IsCheckOut { get; set; }
        /// <summary>
        /// 检出人
        /// </summary>
        /// <returns></returns>
        [NullValue]
        public string CheckOutUserID { get; set; } = "";
        /// <summary>
        /// 检出时间
        /// </summary>
        /// <returns></returns>
        [NullValue]
        public DateTime? CheckOutTime { get; set; }
        /// <summary>
        /// 附件文件夹ID
        /// </summary>
        /// <returns></returns>
        public string FolderId { get; set; } = "";
        /// <summary>
        /// 文件MD5
        /// </summary>
        /// <returns></returns>
        public string FileMD5 { get; set; } = "";
        /// <summary>
        /// 创建人
        /// </summary>
        /// <returns></returns>
        public string CreateUserID { get; set; } = "";
        /// <summary>
        /// 创建时间
        /// </summary>
        /// <returns></returns>
        public DateTime? CreateTime { get; set; }
        /// <summary>
        /// 更新人
        /// </summary>
        /// <returns></returns>
        public string UpdateUserID { get; set; } = "";
        /// <summary>
        /// 更新时间
        /// </summary>
        /// <returns></returns>
        public DateTime? UpdateTime { get; set; }
        /// <summary>
        /// 排序
        /// </summary>
        /// <returns></returns>
        public int? OrderID { get; set; }
        /// <summary>
        /// 材料统计
        /// </summary>
        /// <returns></returns>
        public string MaterialCensus { get; set; } = "";
        /// <summary>
        /// 材料范围
        /// </summary>
        /// <returns></returns>
        public string MaterialRange { get; set; } = "";
        /// <summary>
        /// 是否删除
        /// </summary>
        /// <returns></returns>
        [NullValue]
        public int? IsDelete { get; set; }
        /// <summary>
        /// 删除人
        /// </summary>
        /// <returns></returns>
        [NullValue]
        public string DeleteUserID { get; set; } = "";
        /// <summary>
        /// 删除时间
        /// </summary>
        /// <returns></returns>
        [NullValue]
        public DateTime? DeleteTime { get; set; }
        /// <summary>
        /// 是否工程图纸
        /// </summary>
        /// <returns></returns>
        public int? IsEngineDWG { get; set; }

        #endregion

        #region 扩展操作
        /// <summary>
        /// 新增调用
        /// </summary>
        public void Create()
        {
            this.DrawingFileID = Guid.NewGuid().ToString();
            this.CreateTime = Time.MySqlTime;
            UserInfo userInfo = LoginUserInfo.Get();
            this.CreateUserID = userInfo.userId;

            this.IsPublish = 0;
            this.IsCheckOut = 1;
            this.CheckOutUserID = this.CreateUserID;
            this.CheckOutTime = this.CreateTime;
        }
        /// <summary>
        /// 编辑调用
        /// </summary>
        /// <param name="keyValue"></param>
        public void Modify(string keyValue)
        {
            this.DrawingFileID = keyValue;
            this.UpdateTime = Time.MySqlTime;
            UserInfo userInfo = LoginUserInfo.Get();
            this.UpdateUserID = userInfo.userId;
        }
        #endregion

        #region 扩展字段
        /// <summary> 
        /// 该图纸能被哪些用户编辑 
        /// </summary> 
        /// <returns></returns> 
        [SugarColumn(IsIgnore = true)]
        public List<string> AllUsersCanEdit { get; set; }

        /// <summary> 
        /// 插件端中的是否只读 
        /// </summary> 
        /// <returns></returns> 
        [SugarColumn(IsIgnore = true)]
        public bool ReadOnlyInCAD { get; set; }

        /// <summary> 
        /// 图纸类型 
        /// </summary> 
        /// <returns></returns> 
        [SugarColumn(IsIgnore = true)]
        public string DrawingTypeName { get; set; }
        /// <summary> 
        /// 图纸阶段 
        /// </summary> 
        /// <returns></returns> 
        [SugarColumn(IsIgnore = true)]
        public string DrawingStageName { get; set; }
        /// <summary> 
        /// 所属系统
        /// </summary> 
        /// <returns></returns> 
        [SugarColumn(IsIgnore = true)]
        public string DrawingSystemName { get; set; }

        /// <summary> 
        /// 创建人名称 
        /// </summary> 
        /// <returns></returns> 
        [SugarColumn(IsIgnore = true)]
        public string CreateUserName { get; set; }

        /// <summary> 
        /// 检出人名称 
        /// </summary> 
        /// <returns></returns> 
        [SugarColumn(IsIgnore = true)]
        public string CheckOutUserName { get; set; }

        /// <summary> 
        /// 更新人名称 
        /// </summary> 
        /// <returns></returns> 
        [SugarColumn(IsIgnore = true)]
        public string UpdateUserName { get; set; }

        /// <summary> 
        /// 文件ID 
        /// </summary> 
        /// <returns></returns> 
        [SugarColumn(IsIgnore = true)]
        public string FileId { get; set; }
        /// <summary>
        /// 图元编码
        /// </summary>
        /// <returns></returns>
        [SugarColumn(IsIgnore = true)]
        public string PixelCode { get; set; }
        /// <summary>
        /// 材料统计
        /// </summary>
        /// <returns></returns>
        [SugarColumn(IsIgnore = true)]
        public string MaterialCensusName { get; set; }
        /// <summary>
        /// 材料范围
        /// </summary>
        /// <returns></returns>
        [SugarColumn(IsIgnore = true)]
        public string MaterialRangeName { get; set; }
        #endregion
    }
}

